import 'package:boss/ui/page/takeoutManagement/page/widget/double_formfield.dart';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hi_common/hi_common.dart';

class PackagingRuleRow extends StatelessWidget {
  final String initFirstValue;
  final String initSecondValue;
  final ValueChanged<String> onFirstChanged;
  final ValueChanged<String> onSecondChanged;
  final VoidCallback onDelete;

  PackagingRuleRow({
    Key key,
    this.initFirstValue,
    this.initSecondValue,
    this.onFirstChanged,
    this.onSecondChanged,
    this.onDelete,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return DoubleFormField(
      firstText: '每菜品数量',
      secondText: '份，',
      thirdText: '包装盒金额',
      fourthText: '元',
      firstInputType: TextInputType.number,
      firstInputFormatters: [
        FilteringTextInputFormatter.allow(RegUtil.integerReg),
      ],
      secondInputType: TextInputType.numberWithOptions(decimal: true),
      secondInputFormatters: [
        FilteringTextInputFormatter.allow(RegUtil.integerReg),
      ],
      firstInitValue: initFirstValue,
      secondInitValue: initSecondValue,
      onFirstChanged: onFirstChanged,
      onSecondChanged: onSecondChanged,
      onDelete: onDelete,
      firstEnabled: false,
    );
  }
}
